<?php include 'application/views/header.php' ?>
<?php // echo '<pre>'; print_r($Product); die; ?>
<script type="text/javascript" src="<?php echo base_url() ?>public/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="<?php echo base_url() ?>public/ckfinder/ckfinder.js"></script>
<h4 class="page-title">Sản phẩm</h4>
<div class="flash-message">
    <?php if(is_array($this->session->flashdata('message'))): ?>
        <?php foreach($this->session->flashdata('message') as $item): ?>
            <div><?php echo $item ?></div>
        <?php endforeach; ?>
    <?php else: ?>
        <div><?php echo $this->session->flashdata('message') ?></div>
    <?php endif; ?>
</div>
<form accept="<?php echo base_url() ?>product/edit/<?php echo $Product['ProductId'] ?>" 
accept=""method="post" id="frmPageEdit" enctype="multipart/form-data">
    <table width="100%" class="form page-edit">
       <tr>
            <th>Mã số sản phẩm</th>
            <td><?php echo $Product['ProductId'] ?></td>
       </tr>
       <tr>
            <th>Tên sản phẩm</th>
            <td><input type="text" value="<?php echo $Product['ProductName'] ?>" name="ProductName" id="ProductName"/></td>
       </tr>
       <tr>
            <th>Mô tả ngắn của sản phẩm</th>
            <td>                
                <textarea name="ProductShortDescription" id="ProductShortDescription"><?php echo $Product['ProductShortDescription'] ?></textarea>
            </td>
       </tr>
       <tr>
            <th>Mô tả sản phẩm</th>
            <td>                
                <textarea name="ProductDescription" id="ProductDescription"><?php echo $Product['ProductDescription'] ?></textarea>
            </td>
       </tr>
        <tr>
            <th>So sánh</th>
            <td>
                <textarea id="ProductCompare" name="ProductCompare"><?php echo $Product['ProductCompare'] ?></textarea>
            </td>
       </tr>
       <tr>
            <th>Tổng quan</th>
            <td>
                <textarea id="ProductGeneral" name="ProductGeneral"><?php echo $Product['ProductGeneral'] ?></textarea>
            </td>
       </tr>
       <tr>
            <th>Hình ảnh</th>
            <td>
                <textarea id="ProductPicture" name="ProductPicture"><?php echo $Product['ProductPicture'] ?></textarea>
            </td>
       </tr>
       <tr>
            <th>Chức năng</th>
            <td>
                <textarea id="ProductFuture" name="ProductFuture"><?php echo $Product['ProductFuture'] ?></textarea>
            </td>
       </tr>
       <tr>
            <th>Chi tiết</th>
            <td>
                <textarea id="ProductDetail" name="ProductDetail"><?php echo $Product['ProductDetail'] ?></textarea>
            </td>
       </tr>
       <tr>
            <th>Hình ảnh sản phẩm</th>
            <td>
                <?php if(!empty($Product['Image'])): ?>
                    <img width="150" src="<?php echo $this->config->item('base_download') ?>/products/<?php echo $Product['Image'] ?>"/><br/>
                <?php endif; ?>
                <input type="file" name="Image" id="Image" />
            </td>
       </tr>
       <tr>
            <th>Order</th>
            <td>
                <input type="text" style="width: 50px;" name="Ordering" value="<?php echo isset($Product['Ordering']) ? $Product['Ordering'] : '' ?>" id="Ordering" />
            </td>
       </tr>
       <tr>
            <th>Gía</th>
            <td>
                <input type="text" style="width: 100px;" name="Price" value="<?php echo isset($Product['Price']) ? $Product['Price'] : '' ?>" id="Price" />
            </td>
       </tr>
       <tr>
            <th>Đường dẫn download</th>
            <td>
                <input type="text"name="DownloadTrial" value="<?php echo isset($Product['DownloadTrial']) ? $Product['DownloadTrial'] : '' ?>" id="DownloadTrial" />
            </td>
       </tr>
       <tr>
            <th>Mô trường cài đặt</th>
            <td>
                <input type="text"name="Enviroment" value="<?php echo isset($Product['Enviroment']) ? $Product['Enviroment'] : '' ?>" id="Enviroment" />
            </td>
       </tr>
        <tr>
            <th>Icon sản phẩm</th>
            <td>
                <?php if(!empty($Product['Icon'])): ?>
                    <img width="150" src="<?php echo $this->config->item('base_download') ?>/products/<?php echo $Product['Icon'] ?>"/><br/>
                <?php endif; ?>
                <input type="file" name="Icon" id="Icon" />
            </td>
       </tr>
        <tr>
            <th>Nhóm sản phẩm</th>
            <td>
                <?php echo form_dropdown('ProductCategoryId', $ProductOptions, isset($Product['ProductCategoryId']) ? $Product['ProductCategoryId'] : '') ?>
            </td>
       </tr>
        <tr>
            <th>Ẩn hiện sản phẩm</th>
            <td><input <?php echo ($Product['Visible'] == 1 ? 'checked="checked"' : '') ?>" type="checkbox" value="1" name="Visible" id="Visible"  /></td>
       </tr>
    </table>
    <div class="clr button-set">
        <input type="submit" value="Lưu nội dung" id="btnSave" />
        <input type="reset" value="Hủy nội dung vừa nhập" id="btnReset" />
        <input type="button" value="Về danh sách sản phẩm" id="btnBack" />
    </div>
</form>
<?php include 'application/views/footer.php' ?>
<script>
$('#btnBack').click(function(){
    window.location.href = '<?php echo base_url() ?>product.html'; 
});
var ck = CKEDITOR.replace( 'ProductDetail', { toolbar : 'Full'});
CKFinder.setupCKEditor( ck, { 
    basePath : '/admin/public/ckfinder/' 
} ) ;
var ck = CKEDITOR.replace( 'ProductCompare', { toolbar : 'Full'});
CKFinder.setupCKEditor( ck, { 
    basePath : '/admin/public/ckfinder/' 
} ) ;
var ck = CKEDITOR.replace( 'ProductGeneral', { toolbar : 'Full'});
CKFinder.setupCKEditor( ck, { 
    basePath : '/admin/public/ckfinder/' 
} ) ;
var ck = CKEDITOR.replace( 'ProductPicture', { toolbar : 'Full'});
CKFinder.setupCKEditor( ck, { 
    basePath : '/admin/public/ckfinder/' 
} ) ;
var ck = CKEDITOR.replace( 'ProductFuture', { toolbar : 'Full'});
CKFinder.setupCKEditor( ck, { 
    basePath : '/admin/public/ckfinder/' 
} ) ;
</script>